home *** CD-ROM | disk | FTP | other *** search
- head 1.8;
- branch ;
- access ;
- symbols beta10:1.7;
- locks death:1.8;
- comment @# @;
-
-
- 1.8
- date 93.04.04.23.31.00; author death; state Exp;
- branches ;
- next 1.7;
-
- 1.7
- date 93.01.09.21.07.37; author death; state Exp;
- branches ;
- next 1.6;
-
- 1.6
- date 93.01.01.11.51.43; author death; state Exp;
- branches ;
- next 1.5;
-
- 1.5
- date 92.12.31.15.35.27; author death; state Exp;
- branches ;
- next 1.4;
-
- 1.4
- date 92.12.05.23.07.38; author death; state Exp;
- branches ;
- next 1.3;
-
- 1.3
- date 92.12.03.18.02.11; author death; state Exp;
- branches ;
- next 1.2;
-
- 1.2
- date 92.11.27.19.38.17; author death; state Exp;
- branches ;
- next 1.1;
-
- 1.1
- date 92.11.08.09.29.02; author death; state Exp;
- branches ;
- next ;
-
-
- desc
- @@
-
-
- 1.8
- log
- @Sun Apr 4 23:31:00 PDT 1993
- @
- text
- @%BEGIN Polygons
-
- %%%%%%%%%%%%%
- % Notes:
- % PICTline is defined in the common file. As is penWidth and penHeight
- %%%%%%%%%%%%%
-
- %%%%%%%%%%%%%
- % Name: polyPath
- % Syntax: [x1 y1] ... [xN yN] N rect polyPath -
- % About: Builds a path corresponding to the polygon passed as set of x,y coords
- % (each coord in an array), count of these points, and bounding rectangle.
- % Notes: This changes the clip path. Call inside a gsave/restore. We deliberately
- % end with an open path, since mac polygons aren't always closed(?)
- %%%%%%%%%%%%%
- /polyPath
- {
- /right exch def
- /bottom exch def
- /left exch def
- /top exch def
- /points exch def
- %
- % Build the bounding/clipping rect, and intersect it with the current clip
- %
- newpath
- left top moveto
- right top lineto
- right bottom lineto
- left bottom lineto
- closepath
- clip
- %
- % move to the first point on the stack, then, connect lines to each of the others
- %
- newpath
- /ptarray exch def
- ptarray 0 get
- ptarray 1 get
- moveto
- points 1 sub
- {
- /ptarray exch def
- ptarray 0 get
- ptarray 1 get
- lineto
- }
- repeat % for (points-1) times
- } def
-
- %%%%%%%%%%%%%
- % Name: framePoly [0070]
- % Syntax: [x1 y1] ... [xN yN] N rect framePoly -
- % About: For each coordinate pair of the polygon, call PICTline so it is drawn with
- % the right thickness and overhand.
- % Note: framed polys don't seem affected by the bounding rect.
- %%%%%%%%%%%%%
- /framePoly
- {
- /right exch def
- /bottom exch def
- /left exch def
- /top exch def
- /points exch def
- gsave
- penPattern usePattern
- %
- % Retrieve the first point off the stack, and store.
- %
- /ptarray exch def
- /lastX ptarray 0 get def
- /lastY ptarray 1 get def
- points 1 sub
- {
- %
- % Fetch next point, push last pt, and then define lastX and Y as the new
- % point. Call PICTline with pushed pt. and 'last' pt.
- %
- /ptarray exch def
- lastX lastY
- /lastX ptarray 0 get def
- /lastY ptarray 1 get def
- lastX lastY PICTline
- }
- repeat % for (points-1) times
- grestore
- }
- def
-
- %%%%%%%%%%%%%
- % Name: paintPoly [0071]
- % Syntax: [x1 y1] ... [xN yN] N rect paintPoly -
- % About: Given polygon data, build a path, fill with pen pattern
- %%%%%%%%%%%%%
- /paintPoly
- {
- gsave
- penPattern usePattern
- polyPath
- fill
- grestore
- }
- def
-
- %%%%%%%%%%%%%
- % Name: erasePoly [0072]
- % Syntax: [x1 y1] ... [xN yN] N rect erasePoly -
- % About: Given polygon data, build a path, fill with background pattern
- %%%%%%%%%%%%%
- /erasePoly
- {
- gsave
- backPattern usePattern
- polyPath
- fill
- grestore
- }
- def
-
- %%%%%%%%%%%%%
- % Name: invertPoly [0073]
- % Syntax: [x1 y1] ... [xN yN] N rect invertPoly -
- % About: Call polyPath to consume arguments. But don't invert (dunno how)
- %%%%%%%%%%%%%
- /invertPoly
- {
- gsave
- polyPath
- grestore
- }
- def
-
- %%%%%%%%%%%%%
- % Name: fillPoly [0074]
- % Syntax: [x1 y1] ... [xN yN] N rect fillPoly -
- % About: Passed a polygon, this builds the path, and fills it
- %%%%%%%%%%%%%
- /fillPoly
- {
- gsave
- fillPattern usePattern
- polyPath
- fill
- grestore
- } def
-
- %%%%%%%%%%%%%
- % Name: frameSamePoly [0078]
- % Syntax: - frameSamePoly -
- % About: This is not implemented by Apple, so we do nothing here
- %%%%%%%%%%%%%
- /frameSamePoly
- { }
- def
-
- %%%%%%%%%%%%%
- % Name: paintSamePoly [0079]
- % Syntax: - paintSamePoly -
- % About: This is not implemented by Apple, so we do nothing here
- %%%%%%%%%%%%%
- /paintSamePoly
- { }
- def
-
- %%%%%%%%%%%%%
- % Name: eraseSamePoly [007A]
- % Syntax: - eraseSamePoly -
- % About: This is not implemented by Apple, so we do nothing here
- %%%%%%%%%%%%%
- /eraseSamePoly
- { }
- def
-
- %%%%%%%%%%%%%
- % Name: invertSamePoly [007B]
- % Syntax: - invertSamePoly -
- % About: This is not implemented by Apple, so we do nothing here
- %%%%%%%%%%%%%
- /invertSamePoly
- { }
- def
-
- %%%%%%%%%%%%%
- % Name: fillSamePoly [007C]
- % Syntax: - fillSamePoly -
- % About: This is not implemented by Apple, so we do nothing here
- %%%%%%%%%%%%%
- /fillSamePoly
- { }
- def
-
- %END Polygons
- @
-
-
- 1.7
- log
- @Sat Jan 9 21:07:36 PST 1993
- @
- text
- @@
-
-
- 1.6
- log
- @Fri Jan 1 11:51:43 PST 1993
- @
- text
- @d28 3
- a30 3
- right 1 add top lineto
- right 1 add bottom 1 add lineto
- left bottom 1 add lineto
- @
-
-
- 1.5
- log
- @Thu Dec 31 15:35:27 PST 1992
- @
- text
- @@
-
-
- 1.4
- log
- @Sat Dec 5 23:07:37 PST 1992
- @
- text
- @d3 4
- a6 3
- %
- % PICTline is defined in the common file. As is penWidth and penHeight
- %
- d8 8
- a15 20
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % utility: polyPath
- % Syntax: [x y] ... [x y] n rect polyPath -
- % Description:
- % Takes a polygon from the path, and builds a corresponding path.
- % What is a polygon? Well, it is just a series of line segments (not necessarily
- % 'closed'). It is stored on the stack as: a bounding rectangle (which we ignore),
- % the number of poins making up the polygon, and then the points themselves stored
- % as x,y pairs. Each pair is stored as an array (this is mainly done to make the PS code
- % somewhat legible to the human eye). Loop for the number of points there are,
- % pull out the coords, and build a path with them.
- % Warnings (bugs?):
- % This ends with an open path. It is conceivable that we should be watching if
- % the last point is the same as the first, and close the path if so. I dunno for
- % what PICT does on the Mac...
- % This routine CHANGES THE CLIP PATH. Beware of this. Best to call this inside
- % a gsave/grestore pair.
- % A polygon, even when filled has the same edge boundry nature that a pict line does:
- % it decends down and to the right one pixel. This does NOT replicate that
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- a22 1
-
- d24 1
- a24 1
- % First, build a rectangle that bounds the polygons clipping area, and intersect it with the current clip
- a32 1
-
- d51 7
- a57 12
-
-
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % Opcode: 0070
- % Name: framePoly
- % Syntax: [x y] ... [x y] n rect framePoly -
- % Description:
- % Given a polygon, this walks through the array of points making up
- % the polygon. For every pair (save the first and last), this calls
- % our common routine PICTline to draw the line properly.
- % Note that framed polygons donn't seem affected by the bounding/clipping rectangle
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- d76 2
- a77 4
- % Fetch the next point, push the previous one on the stack as the first
- % pair of arguments to PICTline, get the coords out of the retrieved point,
- % and pass to PICTline (these will be used again as the first args next
- % time through this loop)
- d90 5
- a94 8
-
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % Opcode: 0071
- % Name: paintPoly
- % Syntax: [x y] ... [x y] n rect paintPoly -
- % Description:
- % Given a polygon, this builds its path, and paints it with the pen pattern.
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- d105 5
- a109 9
-
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % Opcode: 0072
- % Name: erasePoly
- % Syntax: [x y] ... [x y] n rect erasePoly -
- % Description:
- % Given a polygon, this builds its path, and fills it with the background
- % pattern (thus 'erasing' it).
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- d120 5
- a124 11
-
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % Opcode: 0073
- % Name: invertPoly
- % Syntax: [x y] ... [x y] n rect invertPoly -
- % Description:
- % Passed a polygon, this builds the path, and inverts it. Well. In theory
- % only. Actually, all this does is build the path so (a) we get the data off
- % the stack, and (b) make it trivial for someone to add code here to make this
- % work as advertised...
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- d133 5
- a137 8
-
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % Opcode: 0074
- % Name: fillPoly
- % Syntax: [x y] ... [x y] n rect fillPoly -
- % Description:
- % Passed a polygon, this builds the path, and fills it
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- d147 2
- a148 4
-
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % Opcode: 0078
- % Name: frameSamePoly
- d150 2
- a151 3
- % Description:
- % This is not presently implemented by Apple, and thus it also does nothing here
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- d156 2
- a157 4
-
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % Opcode: 0079
- % Name: paintSamePoly
- d159 2
- a160 3
- % Description:
- % This is not presently implemented by Apple, and thus it also does nothing here
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- d165 2
- a166 4
-
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % Opcode: 007A
- % Name: eraseSamePoly
- d168 2
- a169 3
- % Description:
- % This is not presently implemented by Apple, and thus it also does nothing here
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- d174 2
- a175 4
-
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % Opcode: 007B
- % Name: invertSamePoly
- d177 2
- a178 3
- % Description:
- % This is not presently implemented by Apple, and thus it also does nothing here
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- d183 2
- a184 4
-
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % Opcode: 007C
- % Name: fillSamePoly
- d186 2
- a187 3
- % Description:
- % This is not presently implemented by Apple, and thus it also does nothing here
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- a190 1
-
- @
-
-
- 1.3
- log
- @Thu Dec 3 18:02:10 PST 1992
- @
- text
- @d84 1
- @
-
-
- 1.2
- log
- @Fri Nov 27 19:38:16 PST 1992
- @
- text
- @@
-
-
- 1.1
- log
- @Sun Nov 8 09:29:02 PST 1992
- @
- text
- @d22 4
- a25 1
- % This routine CHANGES THE CLIP PATH. Beware of this. Best to call this inside a gsave/grestore pair.
- d39 4
- a42 4
- left top moveto
- right 2 add top lineto
- right 2 add bottom 2 add lineto
- left bottom 2 add lineto
- d74 1
- @
-